/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dbo;

/**
 *
 * @author bi
 */
public class Special {
    private String name;
    public Squad squad;
    private float cost;
    private String target;
    private String bonus;
    private int amount;
    private boolean percent;

    public Special(String name, Squad squad, float cost, String target, String bonus, String amount) {
        this.name = name;
        this.squad = squad;
        this.cost = cost;
        this.target = target;
        this.bonus = bonus;
        if (amount.endsWith("%")) {
            this.amount = Integer.parseInt(amount.substring(0,amount.length()-1));
            percent = true;
        } else {
            this.amount = Integer.parseInt(amount);
            percent = false;
        }
    }

    public Special (String name) {
        this.name = name;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the cost
     */
    public float getCost() {
        return cost;
    }

    /**
     * @return the target
     */
    public String getTarget() {
        return target;
    }

    /**
     * @return the bonus
     */
    public String getBonus() {
        return bonus;
    }

    /**
     * @return the amount
     */
    public int getAmount() {
        return amount;
    }

    /**
     * @return the percent
     */
    public boolean isPercent() {
        return percent;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj.getClass().equals(this.getClass())) {
            if (this.hashCode() == obj.hashCode()) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }



}
